//
//  MGInsetLabel.m
//  MGPublic
//
//  Created by lhongl on 2025/10/20.
//

#import "MGInsetLabel.h"

@implementation MGInsetLabel

- (instancetype)init {
    if (self = [super init]) {
        _insets = UIEdgeInsetsZero;
    }
    return self;
}

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        _insets = UIEdgeInsetsZero;
    }
    return self;
}

- (void)drawTextInRect:(CGRect)rect {
    [super drawTextInRect:UIEdgeInsetsInsetRect(rect, _insets)];
}

- (CGSize)intrinsicContentSize {
    CGSize size = [super intrinsicContentSize];
    CGFloat width = _insets.left + _insets.right;
    CGFloat height = _insets.top + _insets.bottom;
    return CGSizeMake(size.width + width, size.height + height);
}


@end
